import 'script!jquery'
import 'script!materialize/dist/js/materialize.js'


import 'fontawesome/css/font-awesome.css'
import 'materialize/dist/css/materialize.css'
import 'src/style/css/style.css'
import 'src/style/sass/style.scss'

jQuery(($)=>{
  jQuery('.button-collapse').sideNav({
      menuWidth: 300, // Default is 240
      edge: 'left', // Choose the horizontal origin
      closeOnClick: true // Closes side-nav on <a> clicks, useful for Angular/Meteor
    }
  );
  $('.tooltipped').tooltip({delay:50})
  $('.add-folder').click((e)=>{
    Materialize.toast('成功收藏', 4000)
  })
  $('.back-to-top').click((e)=>{
    $('body').animate({
			scrollTop:0
		});
  })
  $('body').on('wheel',(e)=>{
    var [direct,top] = wheelDirect(e);
    if(top>600||direct=='down'){
      $('.back-to-top').show();
    }
    if(top<600){
      $('.back-to-top').hide();
    }

  })
});
function wheelDirect(e){
  var direct = e.originalEvent.deltaY>0?'down':'up';
  var top = $('body').scrollTop()
  return [direct,top];
}
